<template>
  <div>
    <p>欢迎光临_vue开发的收银系统_水果店</p>
    <h3>苹果10￥/斤,折扣 &lt;8折&gt; </h3>
    <p>请输入你要购买的斤数<input v-model="num" type="text"></p>
    <button @click="jzFN">结账购买~</button>
    <p>结账单:总价{{ total }}￥元 折后价:{{ discount }}￥元 省了:{{ economize }}￥元</p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      num: '',
      total: 10,
      discount: 8,
      economize: 2
    }
  },
  methods: {
    jzFN() {
      this.total = this.num * this.total
      this.discount = this.total * 0.8
      this.economize = this.total - this.discount
    }
  }
}
</script>

<style>

</style>